//---------------------------- //Utility defines (define "DestinationGroupSize" (count Sites in:(sites Distance Orthogonal (step (to if:(and (!= (var "From") (to)) (is Mover (who at:(to)))))) from:(to) (min 0) ) ) ) (define "PlayableSite" (difference (sites Occupied by:Mover))) (define "IsPlayableSiteType" (is In (to) ("PlayableSite"))) (define "AlongLine" (sites Distance (step #1 (to if:True)) from:(from) (min 1))) (define "FurtherAlongLine" (sites Distance (step #1 (to if:True)) from:(to) (min 1))) (define "MoveTowardFriendInSameLine" (< 0 (count Pieces Mover in:("FurtherAlongLine" #1))) ) (define "MoveToSiteWithFriendVisible" (< 1 (count Pieces Mover in:(sites LineOfSight Piece at:(to) Orthogonal))) //1 because it counts the moving piece as visible, since it was in the from location ) (define "ValueAtTo" (max 1 (max (results from:(last To) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))) ) ) ) ) (define "ValueAtFrom" (set Var "MaxSizeFrom" (max 1 (max (results from:(from) to:("FirstFriend" Orthogonal) (size Group at:(to) Orthogonal if:(= (mover) (who at:(to)))) ) ) ) ) ) (define "FirstFriend" (sites To (move Hop #1 (between (min 0) if:(or { (= (from) (between)) (is Next (who at:(between))) (is Empty (between)) }) ) (to if:(is Mover (who at:(to)))) ) ) ) //-------------------------------------------------------- // Variants (define "MoveOrLOSCapture" (forEach Piece (or (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))) ) ) () ) ) ) (define "PriorityMoveOverCaptureByPiece" (forEach Piece (priority () (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))) ) ) ) ) ) (define "PriorityCaptureOverMoveByPiece" (forEach Piece (priority (move (from) (to (sites LineOfSight Piece at:(from)) if:(is Next (who at:(to))) (apply (remove (to))) ) ) () ) ) ) (define "Shakattrition" (do (set Var "OriginGroupSize" (size Group at:(from)) (then (set Var "From" (from))) ) next:(move (from (from)) (to (intersection (sites Around (from) if:(is Empty (to)))) if:(<= (var "OriginGroupSize") ("DestinationGroupSize") ) ) ) ) ) //----------------------------------------------- // Main routine (game "Conflagration and Keep-a-riding" (players 2) (equipment { (board (hex Hexagon ) use:Cell) (piece "Disc" Each) }) (rules (start { }) (play ) (end ) ) ) //-------------------------------------- // End conditions (define "IsSingleGroupOf" (= 1 (count Groups Cell Orthogonal if:(is #1 (who at:(to))) ) ) ) (define "StandardEnd" (if (or { (no Moves Next) ("IsSingleGroupOf" Mover) ("IsSingleGroupOf" Next) }) { (if ("IsSingleGroupOf" Mover) (result Mover Win) ) (if ("IsSingleGroupOf" Next) (result Next Win) ) ("Last2MoveEnd") } ) ) (define "AMSEnd" (if (no Moves Next) (result Mover Loss))) (define "Last2MoveEnd" ("BlockWin")) //------------------------------------------------- // Options (option "Game" args:{